<?php
		require('config.php');
		$user_id=$_REQUEST['user_id'];
		//$user_id=1;
		$sql="select * from `".$oto."_user_address` where `userId`='".$user_id."'";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$user_address[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($user_address))
		{
			for($i=0;$i<count($user_address);$i++)
			{
				$dizhi='';
				$sql="select * from `".$oto."_areas` where `areaId`='".$user_address[$i]['areaId1']."'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$sheng[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				$sql="select * from `".$oto."_areas` where `areaId`='".$user_address[$i]['areaId2']."'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$shi[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				$sql="select * from `".$oto."_areas` where `areaId`='".$user_address[$i]['areaId3']."'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$xian[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				$sql="select * from `".$oto."_communitys` where `communityId`='".$user_address[$i]['communityId']."'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$jiedao[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($jiedao[$i])) $jiedao_z=$jiedao[$i]['communityName'];
				else $jiedao_z='';
				$dizhi=$sheng[$i]['areaName'].$shi[$i]['areaName'].$xian[$i]['areaName'].$jiedao_z;
				$user_address[$i]['dizhi']=$dizhi.$user_address[$i]['address'];
				$user_address[$i]['addresee1']=$sheng[$i]['areaName'];
				$user_address[$i]['addresee2']=$shi[$i]['areaName'];
				$user_address[$i]['addresee3']=$xian[$i]['areaName'];
				$user_address[$i]['addresee4']=$jiedao_z;
			}
			echo json_encode($user_address);
		}
		else
		{
			echo 0;
		}
		
?>